using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using PointOfSale.Global;

namespace PointOfSale.Transaction
{
	/// <summary>
	/// Summary description for frmPrintBill.
	/// </summary>
	public class frmPrintBill : System.Windows.Forms.Form
	{
		private CrystalDecisions.Windows.Forms.CrystalReportViewer crvPrintBill;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private ReportDocument reportDocument = new ReportDocument();

		//Cac bien dung trong bao cao
		private string billNo;
		private string billDate;
		private string total;
		private string tax;
		private string billAmount;
		private string discount;
		private string supplier;
		private string receiver;
		private string itemName;
		private string purchaseQuantity;
		
		public frmPrintBill(string bn, string bd, string tt, string ta, string ba, string dis, string su, string re, string itn, string qty)
		{
			billNo = bn;
			billDate = bd;
			total = tt;
			tax = ta;
			billAmount = ba;
			discount = dis;
			supplier = su;
			receiver = re;
			itemName = itn;
			purchaseQuantity = qty;
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.crvPrintBill = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
			this.SuspendLayout();
			// 
			// crvPrintBill
			// 
			this.crvPrintBill.ActiveViewIndex = -1;
			this.crvPrintBill.DisplayGroupTree = false;
			this.crvPrintBill.Dock = System.Windows.Forms.DockStyle.Fill;
			this.crvPrintBill.Location = new System.Drawing.Point(0, 0);
			this.crvPrintBill.Name = "crvPrintBill";
			this.crvPrintBill.ReportSource = null;
			this.crvPrintBill.Size = new System.Drawing.Size(696, 504);
			this.crvPrintBill.TabIndex = 0;
			// 
			// frmPrintBill
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(696, 504);
			this.Controls.Add(this.crvPrintBill);
			this.Name = "frmPrintBill";
			this.Text = "frmPrintBill";
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.Load += new System.EventHandler(this.frmPrintBill_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void frmPrintBill_Load(object sender, System.EventArgs e)
		{
			
			rptPrintBill _rptPrintBill = new rptPrintBill();
			_rptPrintBill.SetParameterValue("billNo", billNo);
			_rptPrintBill.SetParameterValue("billDate", billDate);
			_rptPrintBill.SetParameterValue("total", total);
			_rptPrintBill.SetParameterValue("tax", tax);
			_rptPrintBill.SetParameterValue("billAmount", billAmount);
			_rptPrintBill.SetParameterValue("discount", discount);
			_rptPrintBill.SetParameterValue("supplier", supplier);
			_rptPrintBill.SetParameterValue("receiver", receiver);
			_rptPrintBill.SetParameterValue("itemName", itemName);
			_rptPrintBill.SetParameterValue("quantity", purchaseQuantity);
			this.crvPrintBill.ReportSource = _rptPrintBill;
		}
	}
}
